import { Dialog } from 'vant'
export const dealRequest = ({ data, config, onSuccess, onFail }) => {
  if (data.status !== 200) {
    console.log(`失败请求接口: ${config.url} =======> 上送数据`, JSON.parse(config.data));
    console.log(`失败请求接口: ${config.url} =======> 返回数据`, data);
    return onFail ? onFail(data.data) : Dialog.alert({
      title: '系统提示',
      message: data.msg || `${config.url}接口请求失败`
    })
  } else {
    return onSuccess ? onSuccess(data.data) : data.data
  }
}
